﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AddressBook.Entity;
using AddressBook.DAO;

public partial class FeedBack : System.Web.UI.Page
{
    static FeedbackDAO dao = new FeedbackDAO();

    protected void Page_Load(object sender, EventArgs e)
    {
        ResultEntity result = new ResultEntity();
        result.Name = "Feedback";
        try
        {
            if (!string.IsNullOrEmpty(Request["phone"]) && !string.IsNullOrEmpty(Request["content"]))
            {
                Feedback fb = new Feedback
                {
                    FeedbackContent = Request["content"],
                    FeedbackPhone = Request["phone"],
                    FeedbackDate = DateTime.Now
                };
                dao.InsertData(fb);
                result.Desc = string.Empty;
                result.ResultCode = "0";
            }
            else
            {
                result.Desc = "参数不正确！";
                result.ResultCode = "-2";
            }
        }
        catch (Exception ex)
        {
            result.Desc = ex.Message;
            result.ResultCode = "-1";
        }

        Response.Write(Common.ReturnResult(result));
    }
}